package com.developpez.actions;

import java.util.Map;

import org.apache.struts2.interceptor.SessionAware;

import com.developpez.UtilisateurManager;
import com.developpez.domain.Utilisateur;
import com.opensymphony.xwork2.ActionSupport;

public class CritereModifDeveloppeurAction extends ActionSupport implements SessionAware{
	
	private static final long serialVersionUID = 10000L;
	private Utilisateur userModel;
	private int developpeurs;
	private boolean pseudo;
	private boolean codePostal;
	private boolean mail;
	private Map<String, Object> session;
	
	
			
	/**
	 * @return the session
	 */
	public Map <String, Object> getSession() {
		return session;
	}

	/**
	 * @param session the session to set
	 */
	public void setSession (Map session) {
		this.session = session;
	}

	/**
	 * @return the pseudo
	 */
	public boolean isPseudo() {
		return pseudo;
	}

	/**
	 * @param pseudo the pseudo to set
	 */
	public void setPseudo(boolean pseudo) {
		this.pseudo = pseudo;
	}

	/**
	 * @return the codePostal
	 */
	public boolean isCodePostal() {
		return codePostal;
	}

	/**
	 * @param codePostal the codePostal to set
	 */
	public void setCodePostal(boolean codePostal) {
		this.codePostal = codePostal;
	}

	/**
	 * @return the mail
	 */
	public boolean isMail() {
		return mail;
	}

	/**
	 * @param mail the mail to set
	 */
	public void setMail(boolean mail) {
		this.mail = mail;
	}

	/**
	 * @return the userModel
	 */
	public Utilisateur getUserModel() {
		return userModel;
	}

	/**
	 * @param userModel the userModel to set
	 */
	public void setUserModel(Utilisateur userModel) {
		this.userModel = userModel;
	}

	/**
	 * @return the developpeurs
	 */
	public int getDeveloppeurs() {
		return developpeurs;
	}

	/**
	 * @param developpeurs the developpeurs to set
	 */
	public void setDeveloppeurs(int developpeurs) {
		this.developpeurs = developpeurs;
	}
	
	
	

	public String execute() {
		
		System.out.println("dans la methode modifier()......");
		
		
		UtilisateurManager userDAO =new UtilisateurManager();
		
		getSession().clear();
		getSession().put("user", userDAO.rendreDeveloppeurById(developpeurs));
		if (isMail()) getSession().put("isMail",isMail());
		if (isCodePostal())getSession().put("isCodePostal",isCodePostal());
		if (isPseudo())getSession().put("isPseudo",isPseudo());
		
		
		return "success";
				
		
	}

	

	

	
	


}
